package com.example.service.impl;

import com.example.entity.LockAlarm;
import com.example.entity.LockDeviceInfo;
import com.example.mapper.LockAlarmMapper;
import com.example.service.LockAlarmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LockAlarmServiceImpl implements LockAlarmService {
    @Autowired
    private LockAlarmMapper lockAlarmMapper;

    @Override
    public int insertAlarm(LockAlarm lockAlarm) {
        return lockAlarmMapper.insert(lockAlarm);
    }

    @Override
    public List<LockAlarm> getAlarms() {
        return lockAlarmMapper.selectList(null);
    }

    @Override
    public List<LockAlarm> getDeviceAndAlarm() {
        return lockAlarmMapper.selectLatestAlarmByDeviceId();
    }

}
